package net.alteiar.algorithms.builder;

import java.awt.Color;

import net.alteiar.images.metadata.ImageInfo;
import weka.core.Instance;

public class RGBAverageBuilder implements InstanceBuilder {

	@Override
	public Instance createInstance(ImageInfo info, int x, int y) {
		Color c = new Color(info.getValue(x, y));

		double[] values = new double[] { c.getRed(), c.getGreen(), c.getBlue() };
		return new Instance(1.0, values);
	}

	private static String[] ATTRIBUTS = new String[] { "r", "g", "b" };

	@Override
	public String[] getAttributs() {
		return ATTRIBUTS;
	}

}
